﻿<Window x:Class="FontDialogWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="フォント" Height="350" Width="500"
        FontSize="12">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <DockPanel Margin="5">
            <TextBlock DockPanel.Dock="Top" Text="フォント名:" />
            <TextBox Text="{Binding Path=FontFamilies/Name, Mode=OneWay}"
                     IsReadOnly="True"
                     DockPanel.Dock="Top" />
            <ListView ItemsSource="{Binding FontFamilies}"
                      IsSynchronizedWithCurrentItem="True">
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style TargetType="{x:Type GridViewColumnHeader}">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Name}" 
                                               FontSize="12"
                                               FontFamily="{Binding FontFamily}"
                                                />
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
        </DockPanel>

        <DockPanel Margin="0 5 5 5" Grid.Column="1">
            <TextBlock DockPanel.Dock="Top" Text="サイズ:" />
            <TextBox Text="{Binding Path=FontSizes/, Mode=OneWay}"
                     IsReadOnly="True"
                     DockPanel.Dock="Top" />
            <ListView ItemsSource="{Binding FontSizes}"
                      IsSynchronizedWithCurrentItem="True">
                <ListView.View>
                    <GridView>
                        <GridView.ColumnHeaderContainerStyle>
                            <Style TargetType="{x:Type GridViewColumnHeader}">
                                <Setter Property="Visibility" Value="Collapsed"/>
                            </Style>
                        </GridView.ColumnHeaderContainerStyle>
                        <GridViewColumn>
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Padding="0"
                                               FontSize="11">
                                        <TextBlock.Text>
                                            <Binding StringFormat="G" />
                                        </TextBlock.Text>
                                    </TextBlock>

                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                    </GridView>
                </ListView.View>
            </ListView>
        </DockPanel>

        <StackPanel Grid.Column="2" Margin="5">
            <Button Content="OK" Margin="0 0 0 5" Click="OkButton_Click" />
            <Button Content="キャンセル" Padding="10 1 10 1" Click="CancelButton_Click" />
        </StackPanel>

        <GroupBox Grid.Row="1" Grid.ColumnSpan="3" Margin="5"
                  Height="80"
                  Header="サンプル">
            <TextBlock FontFamily="{Binding FontFamilies/FontFamily}" 
                       FontSize="{Binding Path=FontSizesView/, Mode=OneWay}">
                abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789<LineBreak/>
                       すばしっこい茶色の狐はのろまな犬を飛び越える
            </TextBlock>
        </GroupBox>
        
    </Grid>
</Window>
